Axim fix for Windows.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sun, 7 May 2006 20:30:05 +0000 (20:30 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sun, 7 May 2006 20:30:05 +0000 (20:30 +0000)
Magprotoc: deal with COMx (x>9) silliness on Windows.

gpsbabel/axim_gpb.c
gpsbabel/magproto.c

index 9a16fcfc5d99672035edc58186931786b843a34e..49103be376defb0e13347caba463dbc4fa3a2455 100644 (file)
@@ -141,7 +141,7 @@ axim_gpb_read(void)
        char buff[RECORD_LEN];
        route_head *track = NULL;
        size_t bytes;
-       off_t filesize, left;
+       long filesize, left;
 
        fseek(fin, 0, SEEK_END);
        filesize = ftell(fin);
index b48f428f574afe23e91df08cc27966faa1dfb0f1..fd75e9bcb70df4644a602dbd0560af837deb35f6 100644 (file)
@@ -524,15 +524,20 @@ int
 terminit(const char *portname, int create_ok)
 {
        DCB tio;        
+       char *xname = xstrdup("\\\\.\\\\");
        COMMTIMEOUTS timeout;
 
-        is_file = 0;
+    is_file = 0;
+
+       xname = xstrappend(xname, portname);
+       if (xname[strlen(xname)-1] == ':')
+               xname[strlen(xname)-1] = 0;
 
        xCloseHandle(comport);
 
-       comport = CreateFile(portname, GENERIC_READ|GENERIC_WRITE, 0, NULL,
+       comport = CreateFile(xname, GENERIC_READ|GENERIC_WRITE, 0, NULL,
                          OPEN_EXISTING, 0, NULL);
-
+       fprintf(stderr, "Comport: %p %s\n", comport, xname);
        if (comport == INVALID_HANDLE_VALUE) {
                goto try_as_file;
        }